//
// Created by Tony on 2024/7/9.
//

#include "FieldRef.h"
#include "../Class.h"

namespace RtCode {

std::shared_ptr<Field> FieldRef::resolvedField() {
    auto field = mField.lock();
    if (field != nullptr) {
        return field;
    }

    shared_ptr<Class> clazz = resolvedClass();
    field = clazz->getField(memberName());
    mField = field;
    return field;
}

} // namespace RtCode
